<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title id='Description'>Biểu đồ danh thu</title>
    <link rel="stylesheet" href="{{base_url()}}jqwidgets-ver2.4/jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="{{base_url()}}jqwidgets-ver2.4/scripts/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="{{base_url()}}jqwidgets-ver2.4/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="{{base_url()}}jqwidgets-ver2.4/jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="{{base_url()}}jqwidgets-ver2.4/jqwidgets/jqxchart.js"></script>
    <script type="text/javascript" src="{{base_url()}}jqwidgets-ver2.4/jqwidgets/jqxcheckbox.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var theme = "classic";
            sampleData={{$configs["data"]}};
            // prepare jqxChart settings
            var settings = {
                title: "Biểu đồ chi tiết doanh thu tháng năm {{$configs["year"]}}",
                description: "Tổng doanh thu dự kiến ${{$configs["total"]}} (triệu)",
                enableAnimations: true,
                showLegend: true,
                padding: { left: 5, top: 5, right: 5, bottom: 5 },
                titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
                source: sampleData,
                categoryAxis:
                    {
                        text: 'Category Axis',
                        textRotationAngle: 0,
                        dataField: 'Month',
                        showTickMarks: true,
                        tickMarksInterval: 1,
                        tickMarksColor: '#888888',
                        unitInterval: 1,
                        showGridLines: false,
                        gridLinesInterval: 1,
                        gridLinesColor: '#888888',
                        axisSize: 'auto'
                    },
                colorScheme: 'scheme05',
                seriesGroups:
                    [
                        {
                            type: 'splinearea',
                            valueAxis:
                            {
                                unitInterval: {{$configs["unitInterval"]}},
                                minValue: {{$configs["minCash"]}},
                                maxValue: {{$configs["maxCash"]}},
                                displayValueAxis: false,
                                description: 'Doanh thu dự kiến',
                                axisSize: 'auto',
                                tickMarksColor: '#888888'
                            },
                            series: [
                                    { greyScale: true, dataField: 'TotalCashAll', displayText: 'Doanh thu dự kiến', opacity: 0.7 }
                                ]
                        },
                        {
                            type: 'stackedcolumn',
                            columnsGapPercent: 100,
                            seriesGapPercent: 5,
                            valueAxis:
                            {
                                unitInterval: {{$configs["unitInterval"]}},
                                minValue: {{$configs["minCash"]}},
                                maxValue: {{$configs["maxCash"]}},
                                displayValueAxis: true,
                                description: 'Monney (Triệu)',
                                axisSize: 'auto',
                                tickMarksColor: '#888888',
                                gridLinesColor: '#777777'
                            },
                            series: [
                                    { greyScale: false, dataField: 'TotalCash', displayText: 'Đơn hàng(thành công)' },
                                    { greyScale: true, dataField: 'TotalCashUnFinish', displayText: 'Đơn hàng ( chờ xử lý ) ' }
                                ]
                        }
                    ]
            };
            // setup the chart
            $('#jqxChart').jqxChart(settings);
            $("#TotalCash").jqxCheckBox({ width: 140, theme: theme, checked: true });
            $("#TotalCashUnFinish").jqxCheckBox({ width: 140, theme: theme, checked: false });
            $("#TotalCashAll").jqxCheckBox({ width: 120, theme: theme, checked: false });
            var groups = $('#jqxChart').jqxChart('seriesGroups');
            var refreshChart = function () {
                $('#jqxChart').jqxChart({ enableAnimations: false });
                $('#jqxChart').jqxChart('refresh');
            }
            // update greyScale values.
            $("#TotalCash").bind('change', function (event) {
                groups[1].series[0].greyScale = !event.args.checked;
                refreshChart();
            });
            $("#TotalCashUnFinish").bind('change', function (event) {
                groups[1].series[1].greyScale = !event.args.checked;
                refreshChart();
            });
            
            $("#TotalCashAll").bind('change', function (event) {
                groups[0].series[0].greyScale = !event.args.checked;
                refreshChart();
            });
        });
    </script>
</head>
<body class='default' style="margin: 0;padding: 0">
    <div id='jqxChart' style="width: 910px; height: 460px">
    </div>
    <div style='margin-top: 10px;'>
        <div style='float: left;'>
            <div id='TotalCash'>Đơn hàng(Thành công)</div>
        </div>
        <div style='float: left;'>
            <div id='TotalCashUnFinish'>Đơn hàng (chờ xử lý)</div>
        </div>
        <div style='float: left;'>
            <div id='TotalCashAll'>Tổng doanh thu dự kiến</div>
        </div>
    </div>
</body>
</html>